<!DOCTYPE html><html><head><meta charset="utf-8"><style>body {
  width: 45em;
  border: 1px solid #ddd;
  outline: 1300px solid #fff;
  margin: 16px auto;
}

body .markdown-body
{
  padding: 30px;
}

@font-face {
  font-family: fontawesome-mini;
  src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAzUABAAAAAAFNgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABbAAAABwAAAAcZMzaOEdERUYAAAGIAAAAHQAAACAAOQAET1MvMgAAAagAAAA+AAAAYHqhde9jbWFwAAAB6AAAAFIAAAFa4azkLWN2dCAAAAI8AAAAKAAAACgFgwioZnBnbQAAAmQAAAGxAAACZVO0L6dnYXNwAAAEGAAAAAgAAAAIAAAAEGdseWYAAAQgAAAFDgAACMz7eroHaGVhZAAACTAAAAAwAAAANgWEOEloaGVhAAAJYAAAAB0AAAAkDGEGa2htdHgAAAmAAAAAEwAAADBEgAAQbG9jYQAACZQAAAAaAAAAGgsICJBtYXhwAAAJsAAAACAAAAAgASgBD25hbWUAAAnQAAACZwAABOD4no+3cG9zdAAADDgAAABsAAAAmF+yXM9wcmVwAAAMpAAAAC4AAAAusPIrFAAAAAEAAAAAyYlvMQAAAADLVHQgAAAAAM/u9uZ4nGNgZGBg4ANiCQYQYGJgBEJuIGYB8xgABMMAPgAAAHicY2Bm42OcwMDKwMLSw2LMwMDQBqGZihmiwHycoKCyqJjB4YPDh4NsDP+BfNb3DIuAFCOSEgUGRgAKDgt4AAB4nGNgYGBmgGAZBkYGEAgB8hjBfBYGCyDNxcDBwMTA9MHhQ9SHrA8H//9nYACyQyFs/sP86/kX8HtB9UIBIxsDXICRCUgwMaACRoZhDwA3fxKSAAAAAAHyAHABJQB/AIEAdAFGAOsBIwC/ALgAxACGAGYAugBNACcA/wCIeJxdUbtOW0EQ3Q0PA4HE2CA52hSzmZDGe6EFCcTVjWJkO4XlCGk3cpGLcQEfQIFEDdqvGaChpEibBiEXSHxCPiESM2uIojQ7O7NzzpkzS8qRqn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fgF0r/zJQB4nG2JUQuCQBCEd07TTg36fb2IyBaLd3vWaUh/vmSJnvpgmG8YcmS8X3Shf3R7QA4OBUocUKHGER5NNbOOEvwc1txnuWkTRb/aPjimJ5vXabI+3VfOiyS15UWvyezM2xiGOPyuMohOH8O8JiO4Af+FsAGNAEuwCFBYsQEBjlmxRgYrWCGwEFlLsBRSWCGwgFkdsAYrXFhZsBQrAAA=) format('woff');
}

@font-face {
  font-family: octicons-anchor;
  src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAYcAA0AAAAACjQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABMAAAABwAAAAca8vGTk9TLzIAAAFMAAAARAAAAFZG1VHVY21hcAAAAZAAAAA+AAABQgAP9AdjdnQgAAAB0AAAAAQAAAAEACICiGdhc3AAAAHUAAAACAAAAAj//wADZ2x5ZgAAAdwAAADRAAABEKyikaNoZWFkAAACsAAAAC0AAAA2AtXoA2hoZWEAAALgAAAAHAAAACQHngNFaG10eAAAAvwAAAAQAAAAEAwAACJsb2NhAAADDAAAAAoAAAAKALIAVG1heHAAAAMYAAAAHwAAACABEAB2bmFtZQAAAzgAAALBAAAFu3I9x/Nwb3N0AAAF/AAAAB0AAAAvaoFvbwAAAAEAAAAAzBdyYwAAAADP2IQvAAAAAM/bz7t4nGNgZGFgnMDAysDB1Ml0hoGBoR9CM75mMGLkYGBgYmBlZsAKAtJcUxgcPsR8iGF2+O/AEMPsznAYKMwIkgMA5REMOXicY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+h5j//yEk/3KoSgZGNgYYk4GRCUgwMaACRoZhDwCs7QgGAAAAIgKIAAAAAf//AAJ4nHWMMQrCQBBF/0zWrCCIKUQsTDCL2EXMohYGSSmorScInsRGL2DOYJe0Ntp7BK+gJ1BxF1stZvjz/v8DRghQzEc4kIgKwiAppcA9LtzKLSkdNhKFY3HF4lK69ExKslx7Xa+vPRVS43G98vG1DnkDMIBUgFN0MDXflU8tbaZOUk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1xHzTXRqgKzek/mb7nB8RZTCDhGEX3kK/8Q75AmUM/eLkfA+0Hi908Kx4eNsMgudg5GLdRD7a84npi+YxNr5i5KIbW5izXas7cHXIMAau1OueZhfj+cOcP3P8MNIWLyYOBuxL6DRylJ4cAAAB4nGNgYoAALjDJyIAOWMCiTIxMLDmZedkABtIBygAAAA==) format('woff');
}

.markdown-body {
  font-family: sans-serif;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  color: #333333;
  overflow: hidden;
  font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-wrap: break-word;
}

.markdown-body a {
  background: transparent;
}

.markdown-body a:active,
.markdown-body a:hover {
  outline: 0;
}

.markdown-body b,
.markdown-body strong {
  font-weight: bold;
}

.markdown-body mark {
  background: #ff0;
  color: #000;
  font-style: italic;
  font-weight: bold;
}

.markdown-body sub,
.markdown-body sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
.markdown-body sup {
  top: -0.5em;
}
.markdown-body sub {
  bottom: -0.25em;
}

.markdown-body h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

.markdown-body img {
  border: 0;
}

.markdown-body hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  height: 0;
}

.markdown-body pre {
  overflow: auto;
}

.markdown-body code,
.markdown-body kbd,
.markdown-body pre,
.markdown-body samp {
  font-family: monospace, monospace;
  font-size: 1em;
}

.markdown-body input {
  color: inherit;
  font: inherit;
  margin: 0;
}

.markdown-body html input[disabled] {
  cursor: default;
}

.markdown-body input {
  line-height: normal;
}

.markdown-body input[type="checkbox"] {
  box-sizing: border-box;
  padding: 0;
}

.markdown-body table {
  border-collapse: collapse;
  border-spacing: 0;
}

.markdown-body td,
.markdown-body th {
  padding: 0;
}

.markdown-body .codehilitetable {
  border: 0;
  border-spacing: 0;
}

.markdown-body .codehilitetable tr {
  border: 0;
}

.markdown-body .codehilitetable pre,
.markdown-body .codehilitetable div.codehilite {
  margin: 0;
}

.markdown-body .linenos,
.markdown-body .code,
.markdown-body .codehilitetable td {
  border: 0;
  padding: 0;
}

.markdown-body td:not(.linenos) .linenodiv {
  padding: 0 !important;
}

.markdown-body .code {
  width: 100%;
}

.markdown-body .linenos div pre,
.markdown-body .linenodiv pre,
.markdown-body .linenodiv {
  border: 0;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  border-radius: 0;
  -webkit-border-top-left-radius: 3px;
  -webkit-border-bottom-left-radius: 3px;
  -moz-border-radius-topleft: 3px;
  -moz-border-radius-bottomleft: 3px;
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
}

.markdown-body .code div pre,
.markdown-body .code div {
  border: 0;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  border-radius: 0;
  -webkit-border-top-right-radius: 3px;
  -webkit-border-bottom-right-radius: 3px;
  -moz-border-radius-topright: 3px;
  -moz-border-radius-bottomright: 3px;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
}

.markdown-body * {
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.markdown-body input {
  font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  line-height: 1.4;
}

.markdown-body a {
  color: #4183c4;
  text-decoration: none;
}

.markdown-body a:hover,
.markdown-body a:focus,
.markdown-body a:active {
  text-decoration: underline;
}

.markdown-body hr {
  height: 0;
  margin: 15px 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ddd;
}

.markdown-body hr:before,
.markdown-body hr:after {
  display: table;
  content: " ";
}

.markdown-body hr:after {
  clear: both;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 15px;
  margin-bottom: 15px;
  line-height: 1.1;
}

.markdown-body h1 {
  font-size: 30px;
}

.markdown-body h2 {
  font-size: 21px;
}

.markdown-body h3 {
  font-size: 16px;
}

.markdown-body h4 {
  font-size: 14px;
}

.markdown-body h5 {
  font-size: 12px;
}

.markdown-body h6 {
  font-size: 11px;
}

.markdown-body blockquote {
  margin: 0;
}

.markdown-body ul,
.markdown-body ol {
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.markdown-body ol ol,
.markdown-body ul ol {
  list-style-type: lower-roman;
}

.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
  list-style-type: lower-alpha;
}

.markdown-body dd {
  margin-left: 0;
}

.markdown-body code,
.markdown-body pre,
.markdown-body samp {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 12px;
}

.markdown-body pre {
  margin-top: 0;
  margin-bottom: 0;
}

.markdown-body kbd {
  background-color: #e7e7e7;
  background-image: -moz-linear-gradient(#fefefe, #e7e7e7);
  background-image: -webkit-linear-gradient(#fefefe, #e7e7e7);
  background-image: linear-gradient(#fefefe, #e7e7e7);
  background-repeat: repeat-x;
  border-radius: 2px;
  border: 1px solid #cfcfcf;
  color: #000;
  padding: 3px 5px;
  line-height: 10px;
  font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
  display: inline-block;
}

.markdown-body>*:first-child {
  margin-top: 0 !important;
}

.markdown-body>*:last-child {
  margin-bottom: 0 !important;
}

.markdown-body .headeranchor-link {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: block;
  padding-right: 6px;
  padding-left: 30px;
  margin-left: -30px;
}

.markdown-body .headeranchor-link:focus {
  outline: none;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  position: relative;
  margin-top: 1em;
  margin-bottom: 16px;
  font-weight: bold;
  line-height: 1.4;
}

.markdown-body h1 .headeranchor,
.markdown-body h2 .headeranchor,
.markdown-body h3 .headeranchor,
.markdown-body h4 .headeranchor,
.markdown-body h5 .headeranchor,
.markdown-body h6 .headeranchor {
  display: none;
  color: #000;
  vertical-align: middle;
}

.markdown-body h1:hover .headeranchor-link,
.markdown-body h2:hover .headeranchor-link,
.markdown-body h3:hover .headeranchor-link,
.markdown-body h4:hover .headeranchor-link,
.markdown-body h5:hover .headeranchor-link,
.markdown-body h6:hover .headeranchor-link {
  height: 1em;
  padding-left: 8px;
  margin-left: -30px;
  line-height: 1;
  text-decoration: none;
}

.markdown-body h1:hover .headeranchor-link .headeranchor,
.markdown-body h2:hover .headeranchor-link .headeranchor,
.markdown-body h3:hover .headeranchor-link .headeranchor,
.markdown-body h4:hover .headeranchor-link .headeranchor,
.markdown-body h5:hover .headeranchor-link .headeranchor,
.markdown-body h6:hover .headeranchor-link .headeranchor {
  display: inline-block;
}

.markdown-body h1 {
  padding-bottom: 0.3em;
  font-size: 2.25em;
  line-height: 1.2;
  border-bottom: 1px solid #eee;
}

.markdown-body h2 {
  padding-bottom: 0.3em;
  font-size: 1.75em;
  line-height: 1.225;
  border-bottom: 1px solid #eee;
}

.markdown-body h3 {
  font-size: 1.5em;
  line-height: 1.43;
}

.markdown-body h4 {
  font-size: 1.25em;
}

.markdown-body h5 {
  font-size: 1em;
}

.markdown-body h6 {
  font-size: 1em;
  color: #777;
}

.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre,
.markdown-body .admonition {
  margin-top: 0;
  margin-bottom: 16px;
}

.markdown-body hr {
  height: 4px;
  padding: 0;
  margin: 16px 0;
  background-color: #e7e7e7;
  border: 0 none;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 2em;
}

.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
  margin-top: 0;
  margin-bottom: 0;
}

.markdown-body li>p {
  margin-top: 16px;
}

.markdown-body dl {
  padding: 0;
}

.markdown-body dl dt {
  padding: 0;
  margin-top: 16px;
  font-size: 1em;
  font-style: italic;
  font-weight: bold;
}

.markdown-body dl dd {
  padding: 0 16px;
  margin-bottom: 16px;
}

.markdown-body blockquote {
  padding: 0 15px;
  color: #777;
  border-left: 4px solid #ddd;
}

.markdown-body blockquote>:first-child {
  margin-top: 0;
}

.markdown-body blockquote>:last-child {
  margin-bottom: 0;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow: auto;
  word-break: normal;
  word-break: keep-all;
}

.markdown-body table th {
  font-weight: bold;
}

.markdown-body table th,
.markdown-body table td {
  padding: 6px 13px;
  border: 1px solid #ddd;
}

.markdown-body table tr {
  background-color: #fff;
  border-top: 1px solid #ccc;
}

.markdown-body table tr:nth-child(2n) {
  background-color: #f8f8f8;
}

.markdown-body img {
  max-width: 100%;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

.markdown-body code,
.markdown-body samp {
  padding: 0;
  padding-top: 0.2em;
  padding-bottom: 0.2em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(0,0,0,0.04);
  border-radius: 3px;
}

.markdown-body code:before,
.markdown-body code:after {
  letter-spacing: -0.2em;
  content: "\00a0";
}

.markdown-body pre>code {
  padding: 0;
  margin: 0;
  font-size: 100%;
  word-break: normal;
  white-space: pre;
  background: transparent;
  border: 0;
}

.markdown-body .codehilite {
  margin-bottom: 16px;
}

.markdown-body .codehilite pre,
.markdown-body pre {
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  background-color: #f7f7f7;
  border-radius: 3px;
}

.markdown-body .codehilite pre {
  margin-bottom: 0;
  word-break: normal;
}

.markdown-body pre {
  word-wrap: normal;
}

.markdown-body pre code {
  display: inline;
  max-width: initial;
  padding: 0;
  margin: 0;
  overflow: initial;
  line-height: inherit;
  word-wrap: normal;
  background-color: transparent;
  border: 0;
}

.markdown-body pre code:before,
.markdown-body pre code:after {
  content: normal;
}

/* Admonition */
.markdown-body .admonition {
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  position: relative;
  border-radius: 3px;
  border: 1px solid #e0e0e0;
  border-left: 6px solid #333;
  padding: 10px 10px 10px 30px;
}

.markdown-body .admonition table {
  color: #333;
}

.markdown-body .admonition p {
  padding: 0;
}

.markdown-body .admonition-title {
  font-weight: bold;
  margin: 0;
}

.markdown-body .admonition>.admonition-title {
  color: #333;
}

.markdown-body .attention>.admonition-title {
  color: #a6d796;
}

.markdown-body .caution>.admonition-title {
  color: #d7a796;
}

.markdown-body .hint>.admonition-title {
  color: #96c6d7;
}

.markdown-body .danger>.admonition-title {
  color: #c25f77;
}

.markdown-body .question>.admonition-title {
  color: #96a6d7;
}

.markdown-body .note>.admonition-title {
  color: #d7c896;
}

.markdown-body .admonition:before,
.markdown-body .attention:before,
.markdown-body .caution:before,
.markdown-body .hint:before,
.markdown-body .danger:before,
.markdown-body .question:before,
.markdown-body .note:before {
  font: normal normal 16px fontawesome-mini;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  line-height: 1.5;
  color: #333;
  position: absolute;
  left: 0;
  top: 0;
  padding-top: 10px;
  padding-left: 10px;
}

.markdown-body .admonition:before {
  content: "\f056\00a0";
  color: 333;
}

.markdown-body .attention:before {
  content: "\f058\00a0";
  color: #a6d796;
}

.markdown-body .caution:before {
  content: "\f06a\00a0";
  color: #d7a796;
}

.markdown-body .hint:before {
  content: "\f05a\00a0";
  color: #96c6d7;
}

.markdown-body .danger:before {
  content: "\f057\00a0";
  color: #c25f77;
}

.markdown-body .question:before {
  content: "\f059\00a0";
  color: #96a6d7;
}

.markdown-body .note:before {
  content: "\f040\00a0";
  color: #d7c896;
}

.markdown-body .admonition::after {
  content: normal;
}

.markdown-body .attention {
  border-left: 6px solid #a6d796;
}

.markdown-body .caution {
  border-left: 6px solid #d7a796;
}

.markdown-body .hint {
  border-left: 6px solid #96c6d7;
}

.markdown-body .danger {
  border-left: 6px solid #c25f77;
}

.markdown-body .question {
  border-left: 6px solid #96a6d7;
}

.markdown-body .note {
  border-left: 6px solid #d7c896;
}

.markdown-body .admonition>*:first-child {
  margin-top: 0 !important;
}

.markdown-body .admonition>*:last-child {
  margin-bottom: 0 !important;
}

/* progress bar*/
.markdown-body .progress {
  display: block;
  width: 300px;
  margin: 10px 0;
  height: 24px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  background-color: #ededed;
  position: relative;
  box-shadow: inset -1px 1px 3px rgba(0, 0, 0, .1);
}

.markdown-body .progress-label {
  position: absolute;
  text-align: center;
  font-weight: bold;
  width: 100%; margin: 0;
  line-height: 24px;
  color: #333;
  text-shadow: 1px 1px 0 #fefefe, -1px -1px 0 #fefefe, -1px 1px 0 #fefefe, 1px -1px 0 #fefefe, 0 1px 0 #fefefe, 0 -1px 0 #fefefe, 1px 0 0 #fefefe, -1px 0 0 #fefefe, 1px 1px 2px #000;
  -webkit-font-smoothing: antialiased !important;
  white-space: nowrap;
  overflow: hidden;
}

.markdown-body .progress-bar {
  height: 24px;
  float: left;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  background-color: #96c6d7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(0, 0, 0, .1);
  background-size: 30px 30px;
  background-image: -webkit-linear-gradient(
    135deg, rgba(255, 255, 255, .4) 27%,
    transparent 27%,
    transparent 52%, rgba(255, 255, 255, .4) 52%,
    rgba(255, 255, 255, .4) 77%,
    transparent 77%, transparent
  );
  background-image: -moz-linear-gradient(
    135deg,
    rgba(255, 255, 255, .4) 27%, transparent 27%,
    transparent 52%, rgba(255, 255, 255, .4) 52%,
    rgba(255, 255, 255, .4) 77%, transparent 77%,
    transparent
  );
  background-image: -ms-linear-gradient(
    135deg,
    rgba(255, 255, 255, .4) 27%, transparent 27%,
    transparent 52%, rgba(255, 255, 255, .4) 52%,
    rgba(255, 255, 255, .4) 77%, transparent 77%,
    transparent
  );
  background-image: -o-linear-gradient(
    135deg,
    rgba(255, 255, 255, .4) 27%, transparent 27%,
    transparent 52%, rgba(255, 255, 255, .4) 52%,
    rgba(255, 255, 255, .4) 77%, transparent 77%,
    transparent
  );
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, .4) 27%, transparent 27%,
    transparent 52%, rgba(255, 255, 255, .4) 52%,
    rgba(255, 255, 255, .4) 77%, transparent 77%,
    transparent
  );
}

.markdown-body .progress-100plus .progress-bar {
  background-color: #a6d796;
}

.markdown-body .progress-80plus .progress-bar {
  background-color: #c6d796;
}

.markdown-body .progress-60plus .progress-bar {
  background-color: #d7c896;
}

.markdown-body .progress-40plus .progress-bar {
  background-color: #d7a796;
}

.markdown-body .progress-20plus .progress-bar {
  background-color: #d796a6;
}

.markdown-body .progress-0plus .progress-bar {
  background-color: #c25f77;
}

.markdown-body .candystripe-animate .progress-bar{
  -webkit-animation: animate-stripes 3s linear infinite;
  -moz-animation: animate-stripes 3s linear infinite;
  animation: animate-stripes 3s linear infinite;
}

@-webkit-keyframes animate-stripes {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 60px 0;
  }
}

@-moz-keyframes animate-stripes {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 60px 0;
  }
}

@keyframes animate-stripes {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 60px 0;
  }
}

.markdown-body .gloss .progress-bar {
  box-shadow:
    inset 0 4px 12px rgba(255, 255, 255, .7),
    inset 0 -12px 0 rgba(0, 0, 0, .05);
}

/* Multimarkdown Critic Blocks */
.markdown-body .critic_mark {
  background: #ff0;
}

.markdown-body .critic_delete {
  color: #c82829;
  text-decoration: line-through;
}

.markdown-body .critic_insert {
  color: #718c00 ;
  text-decoration: underline;
}

.markdown-body .critic_comment {
  color: #8e908c;
  font-style: italic;
}

.markdown-body .headeranchor {
  font: normal normal 16px octicons-anchor;
  line-height: 1;
  display: inline-block;
  text-decoration: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.headeranchor:before {
  content: '\f05c';
}

.markdown-body .task-list-item {
  list-style-type: none;
}

.markdown-body .task-list-item+.task-list-item {
  margin-top: 3px;
}

.markdown-body .task-list-item input {
  margin: 0 4px 0.25em -20px;
  vertical-align: middle;
}

/* Media */
@media only screen and (min-width: 480px) {
  .markdown-body {
    font-size:14px;
  }
}

@media only screen and (min-width: 768px) {
  .markdown-body {
    font-size:16px;
  }
}

@media print {
  .markdown-body * {
    background: transparent !important;
    color: black !important;
    filter:none !important;
    -ms-filter: none !important;
  }

  .markdown-body {
    font-size:12pt;
    max-width:100%;
    outline:none;
    border: 0;
  }

  .markdown-body a,
  .markdown-body a:visited {
    text-decoration: underline;
  }

  .markdown-body .headeranchor-link {
    display: none;
  }

  .markdown-body a[href]:after {
    content: " (" attr(href) ")";
  }

  .markdown-body abbr[title]:after {
    content: " (" attr(title) ")";
  }

  .markdown-body .ir a:after,
  .markdown-body a[href^="javascript:"]:after,
  .markdown-body a[href^="#"]:after {
    content: "";
  }

  .markdown-body pre {
    white-space: pre;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .markdown-body pre,
  .markdown-body blockquote {
    border: 1px solid #999;
    padding-right: 1em;
    page-break-inside: avoid;
  }

  .markdown-body .progress,
  .markdown-body .progress-bar {
    -moz-box-shadow: none;
    -webkit-box-shadow: none;
    box-shadow: none;
  }

  .markdown-body .progress {
    border: 1px solid #ddd;
  }

  .markdown-body .progress-bar {
    height: 22px;
    border-right: 1px solid #ddd;
  }

  .markdown-body tr,
  .markdown-body img {
    page-break-inside: avoid;
  }

  .markdown-body img {
    max-width: 100% !important;
  }

  .markdown-body p,
  .markdown-body h2,
  .markdown-body h3 {
    orphans: 3;
    widows: 3;
  }

  .markdown-body h2,
  .markdown-body h3 {
    page-break-after: avoid;
  }
}
</style><title>ES6</title></head><body><article class="markdown-body"><div class="toc">
<ul>
<li><a href="#es6">ES6</a><ul>
<li><a href="#_1">变量声明</a></li>
<li><a href="#_2">解构赋值</a><ul>
<li><a href="#_3">解构用途</a></li>
</ul>
</li>
<li><a href="#_4">字符串扩展</a><ul>
<li><a href="#_5">字符串方法</a></li>
<li><a href="#_6">字符串模板, 使用反引号`表示</a></li>
</ul>
</li>
<li><a href="#_7">数组扩展</a><ul>
<li><a href="#_8">静态方法</a></li>
<li><a href="#_9">原型方法</a></li>
<li><a href="#_10">遍历</a></li>
</ul>
</li>
<li><a href="#_11">对象扩展</a></li>
<li><a href="#_12">箭头函数=&gt;</a><ul>
<li><a href="#_13">参数与返回值</a></li>
<li><a href="#this">箭头函数中的this值</a></li>
</ul>
</li>
<li><a href="#symbol">Symbol数据类型</a><ul>
<li><a href="#_14">用途</a></li>
<li><a href="#_15">常用方法</a></li>
<li><a href="#_16">用途</a></li>
</ul>
</li>
<li><a href="#map">Map集合</a><ul>
<li><a href="#_17">方法</a></li>
</ul>
</li>
<li><a href="#set">Set集合</a></li>
</ul>
</li>
</ul>
</div>
<h1 id="es6"><a name="user-content-es6" href="#es6" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>ES6</h1>
<h2 id="_1"><a name="user-content-_1" href="#_1" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>变量声明</h2>
<ul>
<li>
<p>let: 代码块内的变量声明<br />
     1）变量声明不会提升<br />
     2）let不允许相同作用域内多次声明同一变量<br />
     3）块级作用域</p>
</li>
<li>
<p>const:常量声明<br />
     1）声明后无法修改值<br />
     2）块级作用域<br />
     3）const不允许相同作用域内多次声明同一变量</p>
</li>
</ul>
<h2 id="_2"><a name="user-content-_2" href="#_2" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>解构赋值</h2>
<p>ES6允许我们队数组和对象中提取值，对变量进行赋值，这被叫做“解构”</p>
<ul>
<li>
<p>数组：<br />
<pre><code>     1）var [a,b,c] = [1,2,3] //a=1,b=2,c=3
     2）var [a,[[b],c]] = [10,[[20],30]] //a=10,b=20,c=30
     3）var [a,...b] = [1,2,3,4] //a=1,b=[2,3,4]
</code></pre></p>
</li>
<li>
<p>对象：<br />
     1）var {a,b}={a:&rsquo;html&rsquo;,b:&rsquo;css&rsquo;}<br />
     2）变量必须与对象属性名相同，否则为undefined<br />
     3）如果变量名与属性名不相同，则必须写成以下格式才能取到值<br />
          var {a:test} ={a:&rsquo;html&rsquo;,b:&rsquo;css&rsquo;} //test=&gt;html</p>
</li>
<li>解构失败：<br />
     var [a]=[],[b]=1,[c]=&rsquo;jiegou&rsquo;,[d]=false //a,b,c,d都得到undefined</li>
<li>指定默认值：<br />
     var [a=true]=[]<br />
     var {a=10} = {}<blockquote>
<p>解构同样适用于let和const</p>
</blockquote>
</li>
</ul>
<blockquote>
<p>PS:解构只能用于数组和对象，如果解构不成功，变量会返回undefined，但如果对undefined和null解构则会报错（因为其它原始类型的值都可以转为相应的对象。但是，undefined和null不能转为对象）</p>
</blockquote>
<h3 id="_3"><a name="user-content-_3" href="#_3" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>解构用途</h3>
<ul>
<li>交换变量值<br />
     var [x,y] = [y,x];</li>
<li>
<p>函数返回多个值<br />
<pre><code>function example(){
     return [1,2,3]
}

//接收
var [x,y,z] = example();
</code></pre></p>
</li>
<li>
<p>定义函数形参<br />
函数的参数定义方式, 不用再考虑参数的顺序 <br />
<pre><code>function test({x,y,z}){}

//传参
test({x:10,y:20,z:30})

//参数可以设置默认值
fuction test({x=10,y=20,z}){}
</code></pre></p>
</li>
</ul>
<h2 id="_4"><a name="user-content-_4" href="#_4" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>字符串扩展</h2>
<h3 id="_5"><a name="user-content-_5" href="#_5" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>字符串方法</h3>
<ul>
<li>includes<br />
判断是否包含某个字符，返回布尔值<br />
<pre><code>'html5'.includes('html');//true
</code></pre></li>
<li>startsWith/endsWith<br />
<pre><code>let str='google';
str.startsWith('g');  //true
str.endsWith('le');    //true
</code></pre></li>
<li>repeat(n)<br />
得到字符串重复n次后的结果，n可以为小数，但不能为负数<br />
<pre><code>'laoxie'.repeat(2);//laoxielaoxie
</code></pre></li>
</ul>
<h3 id="_6"><a name="user-content-_6" href="#_6" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>字符串模板, 使用反引号`表示</h3>
<p>你可以通过一种更加美观、更加方便的方式向字符串中插入变量<br />
格式：${变量|函数}，<br />
<pre><code> `你好，我的名字叫${username},接下来是我的自我介绍：${introduce()}` 
</code></pre></p>
<blockquote>
<p>模板字符串中所有的空格、新行、缩进，都会原样输出在生成的字符串中。</p>
</blockquote>
<h2 id="_7"><a name="user-content-_7" href="#_7" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>数组扩展</h2>
<h3 id="_8"><a name="user-content-_8" href="#_8" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>静态方法</h3>
<ul>
<li>Array.from()<br />
将类数组(array-like)转化为数组并返回<br />
<pre><code>var list = Array.from(document.getElementsByTagName(&quot;li&quot;));   
</code></pre></li>
<li>Array.of()<br />
将其参数转化为数组<br />
<pre><code>Array.of(1, 2, 3); // [1, 2, 3]
</code></pre></li>
</ul>
<h3 id="_9"><a name="user-content-_9" href="#_9" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>原型方法</h3>
<ul>
<li>Array.prototype.copyWithin()<br />
格式：arr.copyWithin(target, start [, end=arr.length])<br />
最后一个参数为可选参数，省略则为数组长度。该方法在数组内复制从start(包含start)位置到end(不包含end)位置的一组元素覆盖到以target为开始位置的地方<br />
<pre><code>var arr = [1,2,3,4,5,6,7,8,9,0]; 
arr.copyWithin(2,6,8); //[1,2,7,8,5,6,7,8,9,0] 
</code></pre></li>
<li>Array.prototype.find()<br />
格式：array.find(callback);<br />
返回数组中符合条件的第一个元素，如果没有则返回undefind<br />
<pre><code>[1, 2, 3, 4].find(function(item, index, arr) {
   return item &gt; 2; 
}) // 3

[1, 2, 3, 4].find(function(item, index, arr) { 
　　return item &gt; 4; 
}) // undefined
</code></pre></li>
<li>Array.prototype.findIndex()<br />
findIndex()方法与find()方法用法类似，返回的是第一个符合条件的元素的索引，如果没有则返回-1<br />
<pre><code>[1, 2, 3, 4].findIndex(function(el, index, arr) {
   return el &gt; 2; 
}) // 2

[1, 2, 3, 4].findIndex(function(el, index, arr) { 
　　return el &gt; 4; 
}) // -1
</code></pre></li>
</ul>
<h3 id="_10"><a name="user-content-_10" href="#_10" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>遍历</h3>
<ul>
<li>
<p>for..of<br />
<pre><code>var arr = [10,12,18,30]
for (var value of arr) {
  console.log(value);
}
</code></pre></p>
<ul>
<li>这是最简洁、最直接的遍历数组元素的语法</li>
<li>这个方法避开了for-in循环的所有缺陷<blockquote>
<p>for&hellip;of跟for-in的区别很明显，就是直接取值，而不再取下标了</p>
</blockquote>
</li>
<li>与forEach()不同的是，它可以正确响应break、continue和return语句</li>
<li>for-of循环不支持普通对象</li>
<li>for-of循环也可以遍历其它的集合<ul>
<li>DOM节点</li>
<li>字符串</li>
<li>Set/Map集合</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="_11"><a name="user-content-_11" href="#_11" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>对象扩展</h2>
<ul>
<li>Object.assign(obj1,obj2,&hellip;objN);<br />
合并对象<br />
<pre><code>Object.assign({a:1},{b:2},{b:4,c:3}); //{a:1,b:4,c:3}
</code></pre><ul>
<li>只支持浅拷贝（对于引用类型，只拷贝引用）</li>
<li>忽略不可枚举属性 </li>
</ul>
</li>
</ul>
<h2 id="_12"><a name="user-content-_12" href="#_12" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>箭头函数=&gt;</h2>
<p>格式：标识符=&gt;表达式<br />
省略了function、return关键字和大括号。 </p>
<h3 id="_13"><a name="user-content-_13" href="#_13" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>参数与返回值</h3>
<ul>
<li>
<p>零个参数用 () 表示<br />
<pre><code>//传统写法
var sum = function(){
    return 10 + 10;
}

//es6箭头函数
var sum = () =&gt; 10+10;

</code></pre></p>
</li>
<li>
<p>函数只有一个参数（可省略括号）<br />
<pre><code>//传统函数写法
var test = function(x){
    return x+2;
} 

//使用箭头函数
var test = x=&gt;x+2;
</code></pre></p>
</li>
<li>
<p>多个参数<br />
<pre><code>// ES5
var total = values.reduce(function (a, b) {
  return a + b;
}, 0);

// ES6
var total = values.reduce((a, b) =&gt; a + b, 0);
</code></pre></p>
</li>
<li>
<p>函数中包含多行代码时用代码块括起来</p>
<blockquote>
<p>ES6中的规则是，紧随箭头的{被解析为块的开始，而不是对象的开始<br />
<pre><code> // ES5
$(&quot;#confetti-btn&quot;).click(function (event) {
  playTrumpet();
  fireConfettiCannon();
});

// ES6
$(&quot;#confetti-btn&quot;).click(event =&gt; {
  playTrumpet();
  fireConfettiCannon();
});
</code></pre></p>
</blockquote>
<ul>
<li>使用了块语句的箭头函数不会自动返回值，你需要使用return语句将所需值返回</li>
<li>当使用箭头函数返回一个普通对象时，需要将对象包裹在小括号里<br />
<pre><code>//传统写法
var createPerson = function(){
    return {name:'laoxie',age:18}
}

// ES6
var createPerson = ()=&gt;{name:'laoxie',age:18};   // 这样写会报Bug！
var createPerson = ()=&gt;({name:'laoxie',age:18});
</code></pre></li>
</ul>
</li>
<li>
<p>默认参数。<br />
<pre><code>var func1 = (x = 1, y = 2) =&gt; x + y;
func1(); // 得到 3
</code></pre></p>
</li>
<li>
<p>剩余参数<br />
<pre><code>var func2 = (x, ...args) =&gt; { console.log(args) };
func2(1,2,3); // 输出 [2, 3]
</code></pre></p>
</li>
</ul>
<p>箭头函数内部没有constructor方法，也没有prototype，所以不支持new操作</p>
<h3 id="this"><a name="user-content-this" href="#this" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>箭头函数中的this值</h3>
<p>箭头函数没有它自己的this值，箭头函数内的this值继承自外围作用域</p>
<h2 id="symbol"><a name="user-content-symbol" href="#symbol" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Symbol数据类型</h2>
<p>ES6引入了一种新的原始数据类型Symbol，表示独一无二的值，一旦创建后就不可更改，且不能对它设置属性。<br />
<pre><code>// 没有参数的情况
var s1 = Symbol();
var s2 = Symbol();

s1 === s2 // false

// 有参数的情况
var s1 = Symbol(&quot;foo&quot;);
var s2 = Symbol(&quot;foo&quot;);

s1 === s2 // false
</code></pre></p>
<ul>
<li>Symbol函数前不能使用new命令，否则会报错</li>
<li>Symbol函数可以接受一个字符串作为参数，表示对Symbol实例的描述，主要是为了标识和区分，对调式非常有用</li>
<li>Symbol值不能与其他类型的值进行运算</li>
</ul>
<h3 id="_14"><a name="user-content-_14" href="#_14" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>用途</h3>
<ul>
<li>
<p>作为属性名的Symbol<br />
<pre><code>var mySymbol = Symbol();

// 第一种写法
var a = {};
a[mySymbol] = 'Nani';

// 第二种写法（注意加方括号，否则回被当作普通属性）
var a = {
  [mySymbol]: 'Nani'
};

// 第三种写法
var a = {};
Object.defineProperty(a, mySymbol, { value: 'Nani' });

// 以上写法都得到同样结果
a[mySymbol] // &quot;Nani&quot;
</code></pre></p>
<ul>
<li>Symbol值作为对象属性名时，不能用点运算符。</li>
<li>不能用for&hellip;in、for&hellip;of遍历，也无法用Object.keys()、Object.getOwnPropertyNames()获取</li>
</ul>
</li>
</ul>
<h3 id="_15"><a name="user-content-_15" href="#_15" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>常用方法</h3>
<ul>
<li>Symbol.for()<br />
首先在全局中搜索<strong>已登记</strong>的Symbol值，如果有，就返回这个Symbol值，否则就新建并返回一个以该字符串为名称的Symbol值<blockquote>
<p>直接用Symbol()方法创建的Symbol值不会被登记<br />
<pre><code>let one = Symbol(&quot;laoxie&quot;);
let two = Symbol.for(&quot;laoxie&quot;);

//由于创建了两个Symbol值，所以他们不相等
console.log(one===two);//false
</code></pre></p>
</blockquote>
</li>
<li>Symbol.keyFor()<br />
获取被登记的Symbol值<blockquote>
<p>直接使用Symbo()创建的Symbol值的键不会被登记，所以也就获取不到</p>
</blockquote>
</li>
</ul>
<h3 id="_16"><a name="user-content-_16" href="#_16" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>用途</h3>
<ul>
<li>给对象创建私有属性，而且不用担心属性名冲突</li>
</ul>
<h2 id="map"><a name="user-content-map" href="#map" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Map集合</h2>
<p>Map集合,即映射<br />
<pre><code>let map = new Map(); 
map.set(&quot;S0&quot;, &quot;张三&quot;); 
map.set(&quot;S1&quot;, &quot;李四&quot;); 
map.set(&quot;S2&quot;, &quot;王五&quot;);
</code></pre></p>
<ul>
<li>
<p>获取某一个元素 <br />
<pre><code>map.get(&quot;s2&quot;); //王五
</code></pre></p>
</li>
<li>
<p>循环遍历，配合解构赋值 <br />
<pre><code>for(let [key,value] of map){
    console.log(key,value);
}
</code></pre></p>
</li>
</ul>
<h3 id="_17"><a name="user-content-_17" href="#_17" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>方法</h3>
<ul>
<li>Map.prototype.keys() 获取所有键</li>
<li>Map.prototype.values() 获取所有值</li>
<li>Map.prototype.entries() 获取所有键值对，返回类数组</li>
</ul>
<h2 id="set"><a name="user-content-set" href="#set" class="headeranchor-link" aria-hidden="true"><span class="headeranchor"></span></a>Set集合</h2>
<p>Set集合，本质上就是对数组的一种包装<br />
<pre><code>    let imgs = new Set(); 
    imgs.add(1）; 
    imgs.add(1);
    imgs.add(5);
    imgs.add(&quot;5&quot;); 
    imgs.add(new String(&quot;abc&quot;)）; 
    imgs.add(new String(&quot;abc&quot;)）;

    //打印的结果： 1  5  '5'  'abc'  'abc'
</code></pre></p>
<blockquote>
<p>Set集合是默认去重复的，但前提是两个添加的元素严格相等，所以5和&rdquo;5&rdquo;不相等，两个new出来的字符串不相等</p>
</blockquote>
<p>SET集合没有提供下标方式的访问，因此只能使用for来遍历。由于Set集合本质上还是一个map，因此会有以下几种奇怪的遍历方法 </p>
<pre><code>var imgs = new Set(['a','b','c']); //根据KEY遍历 
for(let item of imgs.keys()){
     console.log(item); 
} 
//a 
//b 
//c

//根据VALUE遍历 
for(let item of imgs.values()){
    console.log(item); 
} 
//a 
//b 
//c

//根据KEY-VALUE遍历 
for(let item of imgs.entries()){
    console.log(item); 
} 
//['a','a'] 
//['b','b']
//['c','c']

//普通for...of循环 
for(let item of imgs){
    console.log(item); 
} 
//a 
//b 
//c
</code></pre></article></body></html>